package com.android.huimeiqupin.adapt;

import android.content.Context;
import android.graphics.Paint;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.huimeiqupin.R;
import com.android.huimeiqupin.model.group.ThematicAGoodsData;
import com.android.huimeiqupin.utils.ConstantsUrl;
import com.android.huimeiqupin.utils.ObjectUtils;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2017/6/19.
 */

public class GridThematicListAdapt extends BaseMultiItemQuickAdapter<ThematicAGoodsData.DataBean.ListDataBean, BaseViewHolder> {
    private LayoutInflater Inflater;
    private Context content;

    public GridThematicListAdapt(Context content, List<ThematicAGoodsData.DataBean.ListDataBean> data,String type) {
        super(data);
        addItemType(ConstantsUrl.THEMATICGOODSLISTItemTYPE, R.layout.item_grid_detail_like);
        this.content = content;
        this.Inflater = LayoutInflater.from(content);
    }
    @Override
    protected void convert(BaseViewHolder holder, ThematicAGoodsData.DataBean.ListDataBean mainlistdata) {
        switch (holder.getItemViewType()) {
            case ConstantsUrl.THEMATICGOODSLISTItemTYPE:
                ((TextView) holder.getView(R.id.item_grid_detail_like_number_before)).getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
                ObjectUtils.photo2(content, mainlistdata.getImg_src(),(ImageView) holder.getView(R.id.item_grid_detail_like_img));
                holder.setText(R.id.item_grid_detail_like_title, mainlistdata.getName());
                holder.setText(R.id.item_grid_detail_like_number_after, mainlistdata.getTeam_price());
                holder.setText(R.id.item_grid_detail_like_number_before,mainlistdata.getPrice());
                holder.setText(R.id.item_grid_detail_like_tuanshu, mainlistdata.getTeam_num());
                break;
        }
    }
}
